<?php

use fw\base\Conf;
use fw\tool\Url;

?>

<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="Keywords" content="<?php echo Conf::$all['seo_keyword']; ?>">
    <meta name="description" content="<?php echo Conf::$all['seo_desc']; ?>">
    <title>文档 - <?php echo Conf::$all['title']; ?></title>
    <link rel="icon" href="<?php echo Url::root(); ?>assets/favicon.ico" type="image/x-icon">

    <link rel="stylesheet" href="<?php echo Url::root(); ?>assets/lib/normalize.css">
    <link rel="stylesheet" href="<?php echo Url::root(); ?>assets/front/default.css">
    <style>
        .master {
            padding-top: 34px;
        }

        .media {
            margin: 20px 20px 20px 0;
            width: 300px;
            float: left;
        }

        .media-body, .media-left {
            display: table-cell;
            vertical-align: top;
        }

        .media-left {
            width: 64px;
            height: 64px;
            background: #eee url("<?php echo Url::root(); ?>assets/front/img/icon_doc.png") no-repeat center;
            background-size: 32px;
            border-radius: 4px;
        }

        .icon-url {
            background-image: url("<?php echo Url::root(); ?>assets/front/img/icon_url.png");
        }

        .media-body {
            padding: 0 10px;
        }

        .media-body h4 {
            margin: 0 0 10px 0;
        }

        .media-body h4 > a {
            color: #4A4A4A;
            font-size: 18px;
            font-weight: lighter;
        }

        .media-body h4 > a:hover {
            color: #111;
        }

        .media-body P {
            margin: 0;
            color: #4A4A4A;
        }
    </style>
</head>
<body>

<main>
    <?php require Conf::$all['view_path'] . 'base/aside.php'; ?>
    <article class="master">
        <?php foreach ($data as $fo): ?>
            <div class="media">
                <div class="media-left<?php if ($fo['types'] === 'url') echo ' icon-url'; ?>"></div>
                <div class="media-body">
                    <h4>
                        <?php
                        if ($fo['types'] === 'url') {
                            echo '<a href="' . $fo['url'] . '" target="_blank">' . $fo['title'] . '</a>';
                        } else {
                            echo '<a href="' . Url::to('Chapter/view', ['doc_id' => $fo['doc_id']]) . '" target="_blank">' . $fo['title'] . '</a>';
                        }
                        ?>
                    </h4>
                    <p><?php echo $fo['brief']; ?></p>
                </div>
            </div>
        <?php endforeach; ?>
    </article>
</main>

<script src="<?php echo Url::root(); ?>assets/lib/jquery.js"></script>
<script src="<?php echo Url::root(); ?>assets/front/default.js"></script>

</body>
</html>
